#include "stm32f10x.h"                  // Device header
#include "OLED.h"
#include "bsp_Timer.h"
#include "game_map.h"
#include "usart2.h"
#include "jy61p.h"

//extern float Roll,Pitch,Yaw;
uint8_t s = 0;
uint8_t m = 0;

uint16_t Time;
int16_t a[3];
int8_t read[2];

/**
  * 坐标轴定义：
  * 左上角为(0, 0)点
  * 横向向右为X轴，取值范围：0~127
  * 纵向向下为Y轴，取值范围：0~63
  * 
  *       0             X轴           127 
  *      .------------------------------->
  *    0 |
  *      |
  *      |
  *      |
  *  Y轴 |
  *      |
  *      |   35              125
  *      |
  *   63 |
  *      v
  * 
  */

int main(void)
{

	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	OLED_Init();

	Timer_Init();
	usart2_Init(9600);
	
	Game_map_Init();
	
	while (1)
	{	
	
		OLED_ShowNum(3, 15, Roll , 4, OLED_6X8);
		OLED_Update();
	}
}

void TIM2_IRQHandler(void)
{
	if (TIM_GetITStatus(TIM2, TIM_IT_Update) == SET)
	{
		Time++;
		Time_Add(&Time, &s, &m);



		
		
		TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
	}
}
